<?php
class Mailsender
{
	private $m_sHeaders;
	private $m_sContent;
	private $m_sRecipients;
	private $m_sSubject;
	
	
	/**
	 * send the message
	 *
	 */
	private function send()
	{
		mail($this->m_sRecipients,$this->m_sSubject,$this->m_sContent,$this->m_sHeaders);
	}
	
	/**
	 * Let the internet know that its a HTML message
	 *
	 */
	private function HMTL()
	{
		$this->m_sHeaders .= 'MIME-Version: 1.0' . "\r\n";
		$this->m_sHeaders .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
	}
		
	public function sendMailMessage(MailMessage $p_oMessage)
	{
		$this->m_sRecipients = $p_oMessage->getRecipients();
		$this->m_sSubject = $p_oMessage->getsubject();
		$this->m_sContent = $p_oMessage->getMessage();
		$this->m_sHeaders = $p_oMessage->getHeaders();
		
		if($p_oMessage->getMailType() === 'HTML')
		{
			$this->HMTL();
		}
		
		$this->send();
	}
	
}
?>